<!doctype html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta content="telephone=no" name="format-detection">
    <title>管理中心</title>
    <link rel="stylesheet" href="../style/base.css">
    <link rel="stylesheet" href="../style/layout.css">
    <script src="https://cdn.bootcss.com/jquery/3.2.0/jquery.min.js"></script>
    <script src="../js/paramsTool.js"></script>
    <script src="../../js/layer.js"></script>
</head>
<style>
    .me .bottom{margin-top: 10px}
    .bottom .noVip .banner{width: 100%; height: 370px;}
    .bottom .noVip .banner img{width: 100%; height: 100%;}

    .melist{ width:100%;height:45px;display:block; overflow:hidden;background:#fff;float:right;border-bottom: solid #e7e7e7 1px;}
    .melist .meli_left{ float:left; height:45px; line-height:40px;border-bottom: solid #f0efef 1px; display:block; overflow:hidden; font-family:"黑体"; font-size:14px; font-weight:400; color:#505050;}
    .melist .meli_left .melistimg{width:25px; margin:10px 0 0 10px; float:left; line-height:40px;}
    .melist .meli_left .melistimg img{ float:left; width:100%; float:left; }
    .melist .meli_left .melisttxt{ float:left;height:45px; margin-left:20px; line-height:45px;}
    .melist .meli_left .new{ float:left; height:25px; margin:3px 15px;}
    .melist .meli_left .new img{width:40px; height:40px;}

    .melist .meli_right{float:right; margin:10px 10px 0 0;text-align:right;}
    .melist .meli_right .msg{ line-height:28px; display:block; float:left; color:#CB3536;}
    .melist .meli_right .img{float:left;}
    .melist .meli_right label{font-family:"黑体"; font-size:14px; font-weight:400;}

    .exptxt{margin-right:10px;}
    .exptxt ol{line-height:1.4; color:#505050; font-weight:bold; font-size:13px;}
    .exptxt ol li{ margin:10px 0 0 25px; list-style-type:decimal;width: 90%; text-align: left;}

    .layBtn{width: 90%;padding:10px 5%; margin-top: 10px; color: green;font-size: 15px; text-align: center; border: 1px solid green; border-radius: 5px; background:
            whitesmoke; font-weight: 500;}

</style>
<script>

    var params = queryString();
    var disOpenid,disUid,disCoin,disVip,disPoin;

    if(params.disOpenid){
        disOpenid = params.disOpenid;
        setCookie('disOpenid',params.disOpenid)
    }else {
//        disOpenid = getCookie('disOpenid') || 'o4AyEt2gypi_z981XBQzM5in0q_U';
        disOpenid = getCookie('disOpenid');
    }
    if(params.disUid){
        disUid = params.disUid;
        setCookie('disUid',params.disUid);
    }else {
//        disUid = getCookie('disUid') || 10200;
        disUid = getCookie('disUid');
    }
    if(params.disCoin){
        disCoin = params.disCoin;
        setCookie('disCoin',params.disCoin);
    }else {
        disCoin = getCookie('disCoin');// || 1000;
    }
    if(params.disPoin){
        disPoin = params.disPoin;
        setCookie('disPoin',params.disPoin);
    }else {
        disPoin = getCookie('disPoin');// || 10;
    }
    if(params.disVip){
        disVip = params.disVip;
        setCookie('disVip',params.disVip);
    }else {
        disVip = getCookie('disVip');
    }

    if(params.disOpenid){
        location.href = host+'/distribution/view/me.html';
    }

    if(!disOpenid){
        getDisWxCode();
    }

    window.onload = function () {

        layer.open({
            type: 1,
            title: [
                '提示:保存图片不迷路',
                'border-bottom:1px solid #cfcfcf; color:#40AFFE;text-align:center;'
            ],
            content: '<img src="../images/falert.png" width="80%" style="margin: 0 10%">',
            btn: '我知道了',
            style: 'width:90%; border:0px solid black; margin:0 auto; border-radius:6px;'
        });

        refresh();

        /*$("a").click(function(){

            if(disVip != 1){
                layer.open({
                    content: 'vip用户才能享受会员服务哦~~'
                    ,btn: ['成为会员','残忍拒绝']
                    ,yes: function(index){
                        openVip();
                        layer.close(index);
                    }
                });
                return false;
            }
        });*/

        //点击立即支付

    };
    $("#payClick").click(function(){
        //底部提示
        openVip();
    });
    
    function openVip(){
        if(disVip == 1){
            layer.open({
                content: '您已经是VIP会员啦!'
                , skin: 'msg'
                , time: 1.5 //2秒后自动关闭
            });
        }else {
            layer.open({
                content: '<input type="button" value="微信支付" class="layBtn" onclick="maPay()"><input type="button" value="积分支付" class="layBtn" style="color:orangered "  onclick="poinPay()">'
                ,skin: 'footer'
            });
        }
    }

    function refresh() {
        var layInd = layer.open({
            type: 2,
            content: '刷新中...',
            success: function () {
                console.log('disOpenid:',disOpenid);
                $.ajax({
                    url: host + "/disUserInfo",
                    type: "GET",
                    dataType: 'json',
                    async: true,//请求是否异步，默认为异步，这也是ajax重要特性
                    headers: {"content-type": "application/json", "disopenid": disOpenid},
                    success: function (data) {
                        if (data.code) {
                            layer.close(layInd);
                            layer.open({
                                content: data.info
                                , skin: 'msg'
                                , time: 1.5 //2秒后自动关闭
                            });
                        } else {
                            data = data.user;
                            disCoin = parseInt(data.coin);
                            disPoin = parseInt(data.poin);
                            disVip = parseInt(data.vip);
                            $('#idLabel').html(disUid);
                            $('#money').html(disCoin / 100);
                            $('#poin').html(disPoin);
                            checkVip(disVip);
                            layer.close(layInd);
                        }
                    },
                    error: function () {
                        layer.close(layInd);
                        layer.open({
                            content: '获取信息失败,请重试!'
                            , skin: 'msg'
                            , time: 1.5 //2秒后自动关闭
                        });
                    }
                });

            }
        });
    }

    //控制VIP的显示
    function checkVip(vipFlag){
        if(vipFlag && vipFlag == 1){
            $('.vipLogo').show();
        }else {
            $('.vipLogo').hide();
        }
    }

    //点击我的专属二维码
    function shareCode(){
        location.href = host+'/distribution/view/invitation.html?disOpenid='+disOpenid+'&disUid='+disUid+'&disVip='+disVip+'&disPoin='+disPoin;
    }

    //提现里面点击提现所有
    function popAll(){
        $('#popText').val(disCoin/100);
    }

    //提现记录
    function cashList(){
        location.href = host+'/distribution/view/cashList.html?disOpenid='+disOpenid;
    }

    //我的团队
    function myTeam(){
        location.href = host+'/distribution/view/myBands.html?disOpenid='+disOpenid;
    }

    //积分明细
    function poinList(){
        location.href = host+'/distribution/view/poinList.html?disOpenid='+disOpenid+'&disUid='+disUid+'&disPoin='+disPoin;
    }

    function goMovie(){
        if(disVip != 1){
            layer.open({
                content: 'vip用户才能享受会员服务哦~~'
                ,btn: ['成为会员','狠心拒绝']
                ,yes: function(index){
                    openVip();
                    layer.close(index);
                }
            });
        }else {
            location.href="http://www.csjinyi.cn/app/index.php?i=2&c=entry&eid=1&wxref=mp.weixin.qq.com#wechat_redirect";
        }
    }

    function goTurn(){
        if(disVip != 1){
            layer.open({
                content: 'vip用户才能享受会员服务哦~~'
                ,btn: ['成为会员','狠心拒绝']
                ,yes: function(index){
                    openVip();
                    layer.close(index);
                }
            });
        }else {
            layer.open({
                content: '暂未开放,请耐心等待上线哦~'
                ,skin: 'msg'
                ,time: 1.5 //2秒后自动关闭
            });
        }
    }

    //点击我的奖励
    function myReward(){
        location.href = host+'/distribution/view/comiList.html?disOpenid='+disOpenid;
//        if(disVip != 1){
//            layer.open({
//                content: 'vip用户才能享受会员服务哦~~'
//                ,btn: ['成为会员','狠心拒绝']
//                ,yes: function(index){
//                    $('#payClick').click();
//                    layer.close(index);
//                }
//            });
//        }else {
//            location.href = host+'/distribution/view/comiList.html?disOpenid='+disOpenid;
//        }
    }

    //点击提现
    function popCash(){
        if(disVip != 1){
            layer.open({
                content: '您不是会员,没有余额可以提现哦~'
                ,btn: ['成为会员','残忍拒绝']
                ,yes: function(index){
                    $('#payClick').click();
                    layer.close(index);
                }
            });
        }else if(disCoin < 100){
            layer.open({
                content: '余额不足,快去发展更多玩家参与吧!'
                ,skin: 'msg'
                ,time: 1.5 //2秒后自动关闭
            });
        }else {
            layer.open({
                content: '本次可提现金额: ' +disCoin/100+' &nbsp;&nbsp;<label style="color: #36a2f9" onclick="popAll()"> 提现全部</label> <br><br>'+
                        '提现金额: <input id="popText" type="number" placeholder="请输入提现金额" style="border-bottom: 1px solid skyblue;padding-left: 5px; width: 120px; color:#36a2f9; font-size: 14px;">元<br><br>'+
                        '<label style="color: #888">因微信限制,每次提现一元起!</label>'
                ,btn: ['提现到零钱包','取消提现']
                ,yes: function(index){
                    var postCoin = $('#popText').val() * 100;
                    if(postCoin>disCoin){
                        layer.open({
                            content: '余额不足,快去发展更多玩家参与吧!'
                            ,skin: 'msg'
                            ,time: 1.5 //2秒后自动关闭
                        });
                    }else if(postCoin > 5000){
                        layer.open({
                            content: '单次提现不能超过50元哦'
                            ,skin: 'msg'
                            ,time: 1.5 //2秒后自动关闭
                        });
                    } else {
                        $.ajax({
                            url: host + "/disTransfers",
                            type: "GET",
                            dataType: 'json',
                            async: true,//请求是否异步，默认为异步，这也是ajax重要特性
                            headers: {
                                "content-type": "application/json",
                                "disopenid": disOpenid,
                                "discoin": postCoin
                            },
                            success: function (data) {
                                if (data.code) {
                                    layer.open({
                                        content: data.info
                                        , skin: 'msg'
                                        , time: 1.5 //2秒后自动关闭
                                    });
                                } else {
                                    layer.open({
                                        content: '已成功发放' + (postCoin/100).toFixed(2) + '元至您的微信零钱包'
                                        , btn: ['朕知道了']
                                        , yes: function (index) {
                                            layer.close(index);
                                        }
                                    });
                                    disCoin-=postCoin;
                                    setCookie('disCoin',disCoin);
                                    $('#money').html(disCoin/100);
                                }
                            },
                            error: function () {
                                layer.open({
                                    content: '提现失败,请重试!'
                                    , skin: 'msg'
                                    , time: 1.5 //2秒后自动关闭
                                });
                            }

                        });
                        layer.close(index);
                    }

                }
            });
        }
    };

    function wxPay(){
        layer.open({
            content: '暂不支持微信支付,请使用积分开通会员特权!'
            ,skin: 'msg'
            ,time: 2 //2秒后自动关闭
        });
        return;
        $.ajax({
             url: host+ "/disPay",
             type: "get",
             async:true,//请求是否异步，默认为异步，这也是ajax重要特性
             dataType:'json',
             headers: {"content-type":"application/json","disopenid":disOpenid,"disuid":disUid},
             success:function(data){
                 if(data.code){
                     layer.open({
                     content: data.info
                     ,skin: 'msg'
                     ,time: 1.5 //2秒后自动关闭
                 });
             }else {
                 if (typeof WeixinJSBridge == "undefined"){
                     if( document.addEventListener ){
                         document.addEventListener('WeixinJSBridgeReady',wxPayBridge(data.prepay_id,data._paySignjs,data.nonce_str,data.time_stamp) , false);
                     }else if (document.attachEvent){
                         document.attachEvent('WeixinJSBridgeReady', wxPayBridge(data.prepay_id,data._paySignjs,data.nonce_str,data.time_stamp));
                         document.attachEvent('onWeixinJSBridgeReady', wxPayBridge(data.prepay_id,data._paySignjs,data.nonce_str,data.time_stamp));
                     }
                 }else{
                     wxPayBridge(data.prepay_id,data._paySignjs,data.nonce_str,data.time_stamp);
                 }
                 if(disVip){
                     disVip = 1;
                     setCookie('disVip',disVip);
                     checkVip(disVip);
                 }
             }

             },
             error:function() {
                 layer.open({
                     content: '充值失败!'
                     ,skin: 'msg'
                     ,time: 1.5 //2秒后自动关闭
                 });
             }
         });
    }

    function wxPayBridge(prepay_id,paySignjs,nonce_str,time_stamp) {
        disVip = onBridgeReady(prepay_id,paySignjs,nonce_str,time_stamp);
    }

    function poinPay(){

        if(disVip == 1){
            layer.open({
                content: '您已经是会员啦'
                ,skin: 'msg'
                ,time: 1.5 //2秒后自动关闭
            });
        }else if(disPoin < 10){
            layer.open({
                content: '积分不足,请先充足积分再来吧'
                ,skin: 'msg'
                ,time: 1.5 //2秒后自动关闭
            });
        }else {
            $.ajax({
                url: host+ "/disPoinPay",
                type: "get",
                async:true,//请求是否异步，默认为异步，这也是ajax重要特性
                dataType:'json',
                headers: {"content-type":"application/json","disopenid":disOpenid},
                success:function(data){
                    if(data.code){
                        layer.open({
                            content: data.info
                            , btn: ['朕知道了']
                            , yes: function (index) {
                                layer.close(index);
                            }
                        });
                    }else {
                        disVip = 1;
                        disPoin -= 10;
                        setCookie('disPoin',disPoin);
                        setCookie('disVip',disVip);
                        refresh();
                        layer.open({
                            content: '成为会员成功!'
                            ,skin: 'msg'
                            ,time: 1.5 //2秒后自动关闭
                        });
                    }
                },
                error:function() {
                    layer.open({
                        content: '异常错误!'
                        ,skin: 'msg'
                        ,time: 1.5 //2秒后自动关闭
                    });
                }
            });
        }

    }

    function maPay(){
        $.ajax({
            url: host+ "/disMaPay",
            type: "get",
            async:true,//请求是否异步，默认为异步，这也是ajax重要特性
            dataType:'json',
            headers: {"content-type":"application/json","disopenid":disOpenid,"disuid":disUid},
            success:function(data){
                if(data.payUrl){
                    location.href = data.payUrl;
                }else {
                    layer.open({
                        content: '支付失败,请稍后再试!'
                        ,skin: 'msg'
                        ,time: 1.5 //2秒后自动关闭
                    });
                }

            },
            error:function() {
                layer.open({
                    content: '充值失败!'
                    ,skin: 'msg'
                    ,time: 1.5 //2秒后自动关闭
                });
            }
        });
    }

    function exp() {
        layer.open({
            type: 1,
            title: [
                '推广及佣金规则',
                'background-color:#3682f9; color:#fff; font-weight:bold;text-align:center;'
            ],
            content: '<div class="exptxt"><ol><li>每推广一个有效玩家,一级代理获得5元奖励,直推无限,多推多的.</li><li>隔代推荐人获得0.5元奖励.</li><li>我们会不定期更新更多会员超值活动,大家多多关注哦</li></ol></div>',
            style: 'width:80%; height:250px;border:0px solid black; margin:0 auto; border-radius:6px;'
        });
    }

</script>
<body class="bgf4">
<div class="me">
    <!--<div class="logo"></div>-->
    <div class="top linear">

    	<div class="head">
            <img src="../images/pic3.jpg">
            <div class="vipLogo"><img src="../images/vip.png" onclick="openVip()"></div>
        </div>
        <div class="name">ID:<label id="idLabel">102000</label></div>
        <div class="name" onclick="openVip()" style="font-size: 12px">[ 易起赚 ]</div>

        <div style="width:40px;position: absolute; top: 15px; right: 15px; border: 0px solid #ddd;" onclick="refresh()"><img src="../images/refresh.png" width="30px"></div>

        <div style="width:50px;position: absolute; top: 80px; left: 25px; border: 0px solid #ddd;">
            <div onclick="maPay()" style="text-align: center;font-size: 14px; color: whitesmoke">钱包</div>
            <div id="money" style="text-align: center;color: yellow;line-height: 30px;font-size: 14px;">0.00</div>
            <div style="padding:0 10px;text-align: center;font-size: 14px; color: whitesmoke;border: 1px solid #ddd;border-radius: 30px" onclick="popCash()">提现</div>
        </div>

        <div style="width:50px;position: absolute; top: 80px; right: 25px; border: 0px solid #ddd;">
            <div style="text-align: center;font-size: 14px; color: whitesmoke">积分</div>
            <div id="poin" style="text-align: center;color: yellow;line-height: 30px;font-size: 14px;">0</div>
            <div style="padding:0 10px;text-align: center;font-size: 14px; color: whitesmoke;border: 1px solid #ddd;border-radius: 30px" onclick="poinList()">明细</div>
        </div>

    </div>
    <div class="clear"></div>
    <!--顶部结束-->
    <div class="mid border_t">

        <div class="link border_b">
         <a onclick="myReward()">
          <dl>
          <dt><img src="../images/reward.png" /></dt>
          <dd >我的奖励</dd>
          </dl>
          </a>
           
          <a onclick="goTurn()">
          <dl class="list border_l ">
          <dt><img src="../images/turnplate.png" /></dt>
          <dd>幸运大转盘</dd>
          </dl>
          </a>
          <a onclick="goMovie()">
          <dl class="list border_l ">
          <dt><img src="../images/movie.png" /></dt>
          <dd>在线影院</dd>
          </dl>
          </a>
          <a href="http://weblogin.178dn.net/view/fish.html">
          <dl class="list border_l">
          <dt><img src="../images/fish.png" /></dt>
          <dd>爆款游戏</dd>
          </dl>
          </a>
        </div>
	</div>
    <div class="bottom">
        <!--<div class="noVip" id="payClick">-->
            <!--<div class="banner">-->
                <!--<img src="../images/bot.jpg">-->
            <!--</div>-->
        <!--</div>-->
        <div class="isVip">

            <div class="strategy" onclick="shareCode()">
                <div class="melist" style="border-bottom: solid #e7e7e7 1px;">
                    <div class="meli_left">
                        <div class="melistimg"><img src="../images/melist_06.png"></div>
                        <div class="melisttxt">专属二维码</div>

                    </div>
                    <div class="meli_right">
                        <span><img src="../images/jiantou2.png"></span>
                    </div>
                </div>
            </div>
            <div class="strategy" onclick="exp()">
                <div class="melist" style="border-bottom: solid #e7e7e7 1px;">
                    <div class="meli_left">
                        <div class="melistimg"><img src="../images/handtoh.png"></div>
                        <div class="melisttxt">推广规则</div>

                    </div>
                    <div class="meli_right">
                        <span><img src="../images/jiantou2.png"></span>
                    </div>
                </div>
            </div>

            <div class="clear"></div>
            <div style="margin-top: 10px;"></div>

            <div class="strategy" onclick="cashList()">
                <div class="melist" style="border-bottom: solid #e7e7e7 1px;">
                    <div class="meli_left">
                        <div class="melistimg"><img src="../images/melist_04.png"></div>
                        <div class="melisttxt">提现记录</div>

                    </div>
                    <div class="meli_right">
                        <span><img src="../images/jiantou2.png"></span>
                    </div>
                </div>
            </div>

            <div class="strategy" onclick="myTeam()">
                <div class="melist" style="border-bottom: solid #e7e7e7 1px;">
                    <div class="meli_left">
                        <div class="melistimg"><img src="../images/team.png"></div>
                        <div class="melisttxt">我的团队</div>

                    </div>
                    <div class="meli_right">
                        <span><img src="../images/jiantou2.png"></span>
                    </div>
                </div>
            </div>


        </div>
    </div>
</div>

<!--<div class="clear kongbai9"></div>-->
  <!--&lt;!&ndash;底部导航&ndash;&gt;-->
  <!--<div class="navigation_bar border_t">-->
      <!--<a href="me.html">-->
    <!--<img src="../images/me3.png" style="height: 50px; width: 16%; margin-left: 42%;">-->
          <!--</a>-->
  <!--</div>-->
  <!--&lt;!&ndash;底部导航end&ndash;&gt; -->
</body>
</html>
<!--
-->